package com.hsogoo.study.springmvc.repository;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author huangsaigang
 * Created @2019-09-28.
 */
public class ConfigurationRepository {

    private static Map<String, Class> configurationMap = new ConcurrentHashMap<>();

    public static void register(String key, Class clazz){
        configurationMap.put(key, clazz);
    }

    public static Class[] getConfigurations(){
        Class[] configurations = new Class[configurationMap.size()];
        int i = 0;
        for(Class clazz : configurationMap.values()){
            configurations[i] = clazz;
            i++;
        }
        return configurations;
    }
}
